package com.example.demo.controller;

import com.example.demo.dto.ByIdDTO;
import com.example.demo.service.ModuleInfoService;
import com.example.demo.util.ResultVOUtil;
import com.example.demo.vo.ResultVO;
import com.example.demo.vo.moduleInfo.ModuleInfoDetailVO;
import com.sun.org.apache.xpath.internal.operations.Mod;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author 761472239
 * @Classname ModuleInfoController
 * @Description TODO
 * @Date 2021/4/25 16:14
 */
@RestController
public class ModuleInfoController {

    @Autowired
    ModuleInfoService service;

    @PostMapping("/detail")
    public ResultVO detail(@RequestBody ByIdDTO byIdDTO) {

        ModuleInfo moduleInfo = service.findByModuleId(byIdDTO.getId());
        ModuleInfoDetailVO moduleInfoDetailVO = new ModuleInfoDetailVO();
        BeanUtils.copyProperties(moduleInfo, moduleInfoDetailVO);
        return ResultVOUtil.success(moduleInfoDetailVO);
    }
}
